<%@ page language="java" import="com.litt.core.common.*,com.gouwudai.gobbs.service.IUserService,com.gouwudai.gobbs.vo.UserLoginVO,com.litt.core.exception.NotLoginException,com.gouwudai.gobbs.html.*" pageEncoding="UTF-8"%>
<%
response.setHeader("Pragma","No-cache");//HTTP 1.1
response.setHeader("Cache-Control","no-cache");//HTTP 1.0
response.setHeader("Expires","0");//防止被proxy

//定义属性供页面直接调用
Integer USER_ID = new Integer(0);
String LOGIN_ID = "";
String USER_NAME = "";
String LOGIN_IP = request.getRemoteAddr();
UserLoginVO userLogin = (UserLoginVO)session.getAttribute("USER_LOGIN");
if(userLogin==null)
{
	try
	{		
		IUserService userService = (IUserService)BeanManager.getBean("userService");
		userLogin = userService.userLogin(request.getCookies(),request.getRemoteAddr());	
		session.setAttribute("USER_LOGIN",userLogin);
		USER_ID = userLogin.getUserId();
		LOGIN_ID = userLogin.getLoginId();
		USER_NAME = userLogin.getUserName();
	}
	catch(NotLoginException e)
	{
		//如果没有登陆则跳转到登陆页面
		//Utility.NotLoginException(request,response,e,"user_login.jsp?redirectUrl="+request.getRequestURI());
		//out.close();
		//return;
		//如果没有登陆则显示错误信息页面
		if(userLogin==null||(userLogin.getUserId()==null||userLogin.getUserId().intValue()==0))
		{	
			HtmlConst.errors(out,1,"您尚未登陆，不能进行此操作！点击<a href=\""+request.getContextPath()+"/club/user_login_iframe2.jsp?TB_iframe=true&height=300&width=450\"  title=\"用户登陆\" class=\"thickbox\">此处</a>登陆");
			return;	
		}
	}
}
else
{
	//如果只是以游客方式登陆的话则跳转到登陆页面
	//if(userLogin.getUserId()==null)	
	//{	
		//Utility.NotLoginException(request,response,"您尚未登陆","user_login.jsp?redirectUrl="+request.getRequestURI());
		//out.close();
		//return;
	//}
	//1.判断当前用户是否已登陆
	if(userLogin.getUserId()==null||userLogin.getUserId().intValue()==0)
	{	
	    HtmlConst.errors(out,1,"您尚未登陆，不能进行此操作！点击<a href=\""+request.getContextPath()+"/club/user_login_iframe2.jsp?TB_iframe=true&height=200&width=350\"  title=\"用户登陆\" class=\"thickbox\">此处</a>登陆");
		return;	
	}
	USER_ID = userLogin.getUserId();
	LOGIN_ID = userLogin.getLoginId();
	USER_NAME = userLogin.getUserName();
}
%>

